/*
 * fuzzy_PID.h
 *
 *  Created on: 2021年5月8日
 *      Author: Jiarun
 */

#ifndef CODE_FUZZY_H_
#define CODE_FUZZY_H_


#include "Platform_Types.h"

#define S3010_RIGHT   7560      //7460
#define S3010_MID     6660     //6620
#define S3010_LEFT    5760     //5780



extern uint8 lose_line;
extern uint8 lose_line_dir;
extern int AD_max[6];
extern int AD_min[6];       //电感极值
extern int direction_pwm;


extern uint8 dir_pwm_enable ;

extern float elect_Up_L ;
extern float elect_Up_R ;
extern int AD_data[6];
extern int rule[7][7];
extern int fuzzy_txt[10];
extern float up_curr_elect_val;           //电磁偏差,差和比运算的结果
extern float up_elect_val_delta;
/*****环岛相关变量***/

/*****环岛相关变量***/
/********变速相关变量********/
extern float speed_seg ;
/********变速相关变量********/
extern int Lose_Line_Thres ;
extern int REFIND_LINE ;
/********丢线相关变量********/

/********丢线相关变量********/
/********舵机打角相关变量********/
extern float gyroy_d;
extern int kd_elc;
extern int l_r_sum;
/********舵机打角相关变量********/
extern float elec_k;
extern float elec_k_r;


void Steer_Scan(void);
void Get_Elect_Data();                                          //读取电磁
void Elect_Control_Out();                                       //电磁控制输出

float KalmanFilter_Elect(float curr_elect_val,float last_elect_val);
float Fuzzy(float P, float D);


#endif /* CODE_FUZZY_H_ */
